package com.ruoyi.park.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import cn.hutool.core.util.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.utils.SecurityUtils;
import com.ruoyi.park.mapper.ParkRecruitmentMapper;
import com.ruoyi.park.domain.ParkRecruitment;
import com.ruoyi.park.service.IParkRecruitmentService;

/**
 * 园区企业招聘Service业务层处理
 *
 * @author yangyu
 * @date 2022-07-05
 */
@Service
public class ParkRecruitmentServiceImpl implements IParkRecruitmentService {
    @Autowired
    private ParkRecruitmentMapper parkRecruitmentMapper;

    /**
     * 查询园区企业招聘
     *
     * @param id 园区企业招聘ID
     * @return 园区企业招聘
     */
    @Override
    public ParkRecruitment selectParkRecruitmentById(String id) {
        return parkRecruitmentMapper.selectParkRecruitmentById(id);
    }

    /**
     * 查询园区企业招聘列表
     *
     * @param parkRecruitment 园区企业招聘
     * @return 园区企业招聘
     */
    @Override
    public List<ParkRecruitment> selectParkRecruitmentList(ParkRecruitment parkRecruitment) {
        return parkRecruitmentMapper.selectParkRecruitmentList(parkRecruitment);
    }

    /**
     * 新增园区企业招聘
     *
     * @param parkRecruitment 园区企业招聘
     * @return 结果
     */
    @Override
    public int insertParkRecruitment(ParkRecruitment parkRecruitment) {
        parkRecruitment.setId(IdUtil.getSnowflake(0, 0).nextIdStr());
        parkRecruitment.setCreateTime(DateUtils.getNowDate());
        parkRecruitment.setCreateBy(SecurityUtils.getUsername());
        return parkRecruitmentMapper.insertParkRecruitment(parkRecruitment);
    }

    /**
     * 修改园区企业招聘
     *
     * @param parkRecruitment 园区企业招聘
     * @return 结果
     */
    @Override
    public int updateParkRecruitment(ParkRecruitment parkRecruitment) {
        parkRecruitment.setUpdateTime(DateUtils.getNowDate());
        parkRecruitment.setUpdateBy(SecurityUtils.getUsername());
        return parkRecruitmentMapper.updateParkRecruitment(parkRecruitment);
    }

    /**
     * 批量删除园区企业招聘
     *
     * @param ids 需要删除的园区企业招聘ID
     * @return 结果
     */
    @Override
    public int deleteParkRecruitmentByIds(String[] ids) {
        return parkRecruitmentMapper.deleteParkRecruitmentByIds(ids);
    }

    /**
     * 删除园区企业招聘信息
     *
     * @param id 园区企业招聘ID
     * @return 结果
     */
    @Override
    public int deleteParkRecruitmentById(String id) {
        return parkRecruitmentMapper.deleteParkRecruitmentById(id);
    }
}
